package com.example.controller;

import com.example.pojo.IdList;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.Arrays;
import java.util.List;

@Controller
public class ArrayBindingTestController {

    @GetMapping
    public String index() {
        return "/WEB-INF/jsp/index.jsp";
    }

    @PostMapping("/array")
    public String testArrayBinding(Integer[] id) {
        System.out.println("id = " + Arrays.toString(id));

        return "/WEB-INF/jsp/index.jsp";
    }

    @PostMapping("/list")
    public String testListBinding(IdList idList) {
        System.out.println("idList = " + idList);

        return "/WEB-INF/jsp/index.jsp";
    }
}
